export const readOptions = [
  {
    label: "未阅",
    value: 0,
  },
  {
    label: "已阅",
    value: 1,
  },
];

export const businessStatusOptions = [
  { label: "草稿", value: "DRAFT" },
  { label: "在办", value: "UNDO" },
  { label: "办结", value: "DONE" },
  { label: "审批中", value: "AUDIT" },
  { label: "已审批", value: "AUDITED" },
  { label: "已归档", value: "FINISH" },
  { label: "已撤回", value: "REBACK" },
];

export const formData = {
  businessId: "",
  businessType: "",
  auditMemo: "",
  createBy: "",
  deptName: "",
  createTime: "",
  telephone: "",
  startTime: "",
  endTime: "",
  title: "",
  publishTime: "",
  publishScope: "",
  receiptStatus: "",
  content: "",
  auditItems: [],
  businessStatus: "",
  auditorIds: "",
  auditorNames: "",
  busiAttachIds: "", //文件ids
  busiAttachs: [],
  readerIds: [],
  publishScopeName: "",
  receiptMemo: "",
  readerId: "",
};

export const baseFileds = (type, publishScope, personList) => {
  return [
    {
      key: "createBy",
      filedType: "Input",
      label: "创建人",
      span: 12,
      disabled: true,
    },
    {
      key: "deptName",
      filedType: "Input",
      label: "所在部门",
      span: 12,
      disabled: true,
    },

    {
      key: "createTime",
      filedType: "Input",
      label: "创建时间",
      span: 12,
      disabled: true,
      isTimeFilter: true,
    },
    {
      key: "telephone",
      filedType: "Input",
      label: "联系电话",
      span: 12,
      disabled: type !== "add",
      props: {
        placeholder: "请输入联系电话",
        type: "number",
        rules: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
      },
    },
    {
      key: "title",
      filedType: "Input",
      label: "文件标题",
      span: 12,
      disabled: type !== "add",
      props: {
        rules: [{ required: true, message: "请输入文件标题", trigger: "blur" }],
      },
    },
    {
      key: "publishTime",
      filedType: "DatePicker",
      label: "公告日期",
      span: 12,
      disabled: type !== "add",
      isTimeFilter: true,
      props: {
        placeholder: "请输入公告日期",
        valueFormat: "yyyy-MM-dd",
        type: "date",
        rules: [
          { required: true, message: "请选择公告日期", trigger: "change" },
        ],
      },
    },
    {
      key: "publishScope",
      showKey: "publishScopeName",
      filedType: "Radio",
      label: "发布范围",
      span: 12,
      disabled: type !== "add",
      props: {
        options: [
          {
            label: "全部人员",
            value: "ALL",
          },
          {
            label: "指定传阅人",
            value: "DESIGNEE",
          },
        ],
        rules: [
          { required: true, message: "请选择发布范围", trigger: "change" },
        ],
      },
    },
    {
      key: "receiptStatus",
      filedType: "custom",
      label: "是否需要回执",
      span: 12,
    },
    {
      key: "readerIds",
      filedType: "Cascader",
      label: "指定传阅人",
      hidden: publishScope !== "DESIGNEE",
      span: 24,
      props: {
        options: personList,
        filterable: true,
        showAllLevels: false,
        disabled: type !== "add",
        props: {
          multiple: true,
          value: "personId",
          label: "name",
          children: "cimContactsVOList",
        },
      },
    },
    {
      key: "content",
      filedType: "Input",
      label: "正文",
      span: 24,
      disabled: type !== "add",
      props: {
        placeholder: "请输入正文",
        type: "textarea",
        rules: [{ required: true, message: "请输入正文", trigger: "blur" }],
      },
    },
  ];
};
